
/*
 * 懒汉式
 */
public class Singleton {
		String name = null;
		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
		 public void printInfo() {  
		        System.out.println("the name is " + name);  
		 }  
		private Singleton(){
			
		}
		private static Singleton single=null;
		
		public static Singleton getInstace(){
			if(single==null){
				single = new Singleton();
			}
			return single;
		}
}
